import "package:flutter/material.dart";

class FavouritePage {
  static PageRoute getPage(Set data) {
    return new MaterialPageRoute(builder: (context) {
      final tiles = data.map((pair) {
        return new ListTile(
            title: new Text(pair.asPascalCase,
                style: new TextStyle(color: Colors.black, fontSize: 21.0)));
      });
      final divided =
          ListTile.divideTiles(context: context, tiles: tiles).toList();
      return new Scaffold(
          appBar: new AppBar(title: Text('收藏夹')),
          body: new ListView(children: divided));
    });
  }

  static void showAlert(BuildContext context, Set _saved) {
    showDialog(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext conext) {
          return new AlertDialog(
              title: new Text('收藏数量'),
              actions: <Widget>[
                new FlatButton(
                  child: new Text('我知道啦！'),
                  onPressed: () {
                    Navigator.of(conext).pop();
                  },
                )
              ],
              content: new SingleChildScrollView(
                  child: new ListBody(
                children: <Widget>[
                  new Text('现在看的的收藏信息'),
                  new Text('共搜藏了${_saved.length}条记录')
                ],
              )));
        });
  }
}
